blob: 626e281596c57d38b6df7bbf311494ee9c74da7f [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231git-apply(1)
2============
3
4NAME
5----
6git-apply - Apply patch on a git index file and a work tree
7
8
9SYNOPSIS
10--------
11'git-apply' [--stat] [--numstat] [--summary] [--check] [--index] [--apply] [--no-add] [--index-info] [--allow-binary-replacement] [-z] [<patch>...]
12
13DESCRIPTION
14-----------
15Reads supplied diff output and applies it on a git index file
16and a work tree.
17
18OPTIONS
19-------
20<patch>...::
21The files to read patch from. '-' can be used to read
22from the standard input.
23
24--stat::
25Instead of applying the patch, output diffstat for the
26input. Turns off "apply".
27
28--numstat::
29Similar to \--stat, but shows number of added and
30deleted lines in decimal notation and pathname without
31abbreviation, to make it more machine friendly. Turns
32off "apply".
33
34--summary::
35Instead of applying the patch, output a condensed
36summary of information obtained from git diff extended
37headers, such as creations, renames and mode changes.
38Turns off "apply".
39
40--check::
41Instead of applying the patch, see if the patch is
42applicable to the current work tree and/or the index
43file and detects errors. Turns off "apply".
44
45--index::
46When --check is in effect, or when applying the patch
47(which is the default when none of the options that
48disables it is in effect), make sure the patch is
49applicable to what the current index file records. If
50the file to be patched in the work tree is not
51up-to-date, it is flagged as an error. This flag also
52causes the index file to be updated.
53
54--index-info::
55Newer git-diff output has embedded 'index information'
56for each blob to help identify the original version that
57the patch applies to. When this flag is given, and if
58the original version of the blob is available locally,
59outputs information about them to the standard output.
60
61-z::
62When showing the index information, do not munge paths,
63but use NUL terminated machine readable format. Without
64this flag, the pathnames output will have TAB, LF, and
65backslash characters replaced with `\t`, `\n`, and `\\`,
66respectively.
67
68--apply::
69If you use any of the options marked ``Turns off
70"apply"'' above, git-apply reads and outputs the
71information you asked without actually applying the
72patch. Give this flag after those flags to also apply
73the patch.
74
75--no-add::
76When applying a patch, ignore additions made by the
77patch. This can be used to extract common part between
78two files by first running `diff` on them and applying
79the result with this option, which would apply the
80deletion part but not addition part.
81
82--allow-binary-replacement::
83When applying a patch, which is a git-enhanced patch
84that was prepared to record the pre- and post-image object
85name in full, and the path being patched exactly matches
86the object the patch applies to (i.e. "index" line's
87pre-image object name is what is in the working tree),
88and the post-image object is available in the object
89database, use the post-image object as the patch
90result. This allows binary files to be patched in a
91very limited way.
92
93Author
94------
95Written by Linus Torvalds <torvalds@osdl.org>
96
97Documentation
98--------------
99Documentation by Junio C Hamano
100
101GIT
102---
103Part of the gitlink:git[7] suite
104